package lesson16;

class Person
{
	static String courseName = "JAVAEE";
	public String name;
	String address;
	int age;
	private String egn;
	private String password;
	City c = new City();
	private Person()
	{
		name = "Ivan";
		age = 0;
	}
	void setAge(int newAge)
	{
		this.age = newAge;
	}
	int getAge(String password)
	{
		if(this.password.equals(password))
		{
			return this.age;
		}
		else
			return -1;
	}
	Person(String password, int age)
	{
		this();
		if(this.password!=null)
		{
			this.password = password;
		}
		this.age = age;
	}
	public void changePassword(String oldPass, String newPass)
	{
		if(this.password.equals(oldPass))
		{
			this.password = newPass;
		}
		else
		{
			System.out.println("Password missmatch.Please try again!");
		}
	}
	void changeCity(final City newCity)
	{
		newCity.name = "Sofia";
		c = newCity;
	}
	
}
